package com.yunji.storage.enums;

import java.util.Objects;

/**
 * @Project: yunji-coffee
 * @Package: com.yunji.storage.enums
 * @Title: DiscardStatus
 * <p>
 * History:
 * Date                     Version     Author          Summary
 * ============================================================
 * 2024-08-24 14:51:16      V1.0        HuaAo       新建类
 */

public enum DiscardStatus {
    DRAFT(0, "草稿"),
    COMMIT(1, "已提交"),
    FINISH(2, "已完成"),
    CANCEL(3, "已取消"),
    SCRAP(4, "作废");

    private final Integer code;
    private final String text;

    DiscardStatus(Integer code, String text) {
        this.code = code;
        this.text = text;
    }

    public Integer getCode() {
        return code;
    }

    public String getText() {
        return text;
    }

    public static String get(Integer code) {
        DiscardStatus[] enums = DiscardStatus.values();
        for (DiscardStatus e : enums) {
            if (Objects.equals(e.code, code)) {
                return e.text;
            }
        }
        return null;
    }
}